package com.longfor.dragonshard.task;

import com.longfor.drogon.common.exception.LFBizException;
import com.longfor.drogon.common.util.LFTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定时任务Demo
 *
 * @author chi.zhang
 * @version v1.0
 * @create 2017-12-22 上午8:57
 **/
@Component
public class DemoTask {
    private static final Logger logger = LoggerFactory.getLogger(DemoTask.class);

    @Scheduled(cron = "0 27-28 * * * ? ")
    public void timerCron() {
        //todo 业务逻辑
        System.out.println("current time : "+ LFTime.getCurrentTimeInString());

        //用于测试异常情况
        throw new LFBizException("Test Error");
    }

}
